<template>
    <div class="mui-numbox" data-numbox-min='1' data-numbox-max='max'>
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input id="test" class="mui-input-numbox" type="number" value="1" @change="valChanged" ref="count" />
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</template>


<script>
import mui from '../../lib/mui/js/mui.js'
        export default {
            props:["max"],
            mounted(){
                mui('.mui-numbox').numbox()
            },
            watch:{
                'max':function(newVal,oldVal){
                    // console.log(newVal,oldVal)
                    mui('.mui-numbox').numbox().setOption('max',newVal)
                }
            },
            methods:{
                valChanged(){
                    // console.log(this.$refs.count.value)
                    const count =parseInt(this.$refs.count.value)
                    // console.log(count)
                    this.$emit('func',count)
                }
            }
        }
</script>


<style lang="scss" scoped>

</style>
